<?php

class Printer Extends CI_Controller
{
	public function __construct()
	{
		parent::__construct();
		$this->load->library('mpdf');
		
	}

	public function teachers()
	{
		$this->load->model('m_view','m');
		$data['teachers'] = $this->m->get_teach();
		$structure = $this->load->view('print/teachers',$data,TRUE);
		$filename = 'teachers-'.date(M-d-Y);
		$this->_init_print($filename,$structure);
	}
	
	public function administrative()
	{
		$this->load->model('m_view','m');
		$data['administrative'] = $this->m->get_admin();
		$structure = $this->load->view('print/administrative',$data,TRUE);
		$filename = 'administrative-'.date(M-d-Y);
		$this->_init_print($filename,$structure);
	}
	
	public function all()
	{
		$this->load->model('m_view','m');
		$data['teachers'] = $this->m->get_teach();
		$data['administrative'] = $this->m->get_admin();
		$structure = $this->load->view('print/all',$data,TRUE);
		$filename = 'all-'.date(M-d-Y);
		$this->_init_print($filename,$structure);
	}
	
	private function _init_print($filename = '',$data= '')
	{
		$mpdf=new mPDF('c','A4','','' , 5 , 5 , 5 , 5 , 0 , 0);
		$mpdf->SetDisplayMode('fullpage');
		$mpdf->list_indent_first_level = 0;  // 1 or 0 - whether to indent the first level of a list
		$mpdf->WriteHTML($data);
		$mpdf->Output($filename,'I');	
	}





















}